using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using NetWorkMsg;

// 网关模块
namespace NetMsg.Equip
{
    public class EquipInfo : IUnPackable
    {
        public int EquipId;
        public int CfgId;
        public int Level;
        public int Health;
        public int Attack;
        public int IceDef;
        public int FireDef;
        public int StormDef;
        public int PoisonDef;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out uint var0);
            EquipId = (int)var0;
            UnPackAuxiliary.Read(stream, out uint var1);
            CfgId = (int)var1;
            UnPackAuxiliary.Read(stream, out uint var2);
            Level = (int)var2;
            UnPackAuxiliary.Read(stream, out uint var3);
            Health = (int)var3;
            UnPackAuxiliary.Read(stream, out uint var4);
            Attack = (int)var4;
            UnPackAuxiliary.Read(stream, out uint var5);
            IceDef = (int)var5;
            UnPackAuxiliary.Read(stream, out uint var6);
            FireDef = (int)var6;
            UnPackAuxiliary.Read(stream, out uint var7);
            StormDef = (int)var7;
            UnPackAuxiliary.Read(stream, out uint var8);
            PoisonDef = (int)var8;
        }
    }
    
    public struct GetEquipBagQ : IServerCallbackable
    {
        
        public uint UnPackableId => 8;
        public uint PackableId => 21;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 21u);
        }
    }
    
    public class GetEquipBagP : IUnPackable
    {
        // 材料数
        public int Material;
        public List<EquipInfo> Equips;
        
        public const uint Sid = 8;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out uint var0);
            Material = (int)var0;
            UnPackAuxiliary.Read(stream, out uint var1);
            Equips = new List<EquipInfo>((int)var1);
            for(var i = 0; i < var1; ++i)
            {
                var var2 = new EquipInfo();
                var2.UnPack(stream);
                Equips.Add(var2);
            }
        }
    }
    
    public struct UpgradeIncInfo : IUnPackable
    {
        public int Health;
        public int Attack;
        public int IceDef;
        public int FireDef;
        public int StormDef;
        public int PoisonDef;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out uint var0);
            Health = (int)var0;
            UnPackAuxiliary.Read(stream, out uint var1);
            Attack = (int)var1;
            UnPackAuxiliary.Read(stream, out uint var2);
            IceDef = (int)var2;
            UnPackAuxiliary.Read(stream, out uint var3);
            FireDef = (int)var3;
            UnPackAuxiliary.Read(stream, out uint var4);
            StormDef = (int)var4;
            UnPackAuxiliary.Read(stream, out uint var5);
            PoisonDef = (int)var5;
        }
    }
    
    // 升级结果
    public enum UpgradeResult
    {
        // 成功
        Success,
        // 最大等级
        MaxLevel,
        // 钱不够
        NoGold,
        // 材料不够
        NoMaterial,
    }
    
    public struct UpgradeQ : IServerCallbackable
    {
        public int EquipId;
        
        public uint UnPackableId => 9;
        public uint PackableId => 22;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 22u);
            PackAuxiliary.Write(stream, (uint)EquipId);
        }
    }
    
    public class UpgradeP : IUnPackable
    {
        public UpgradeResult Result;
        public UpgradeIncInfo Info;
        
        public const uint Sid = 9;
        
        public void UnPack(MemoryStream stream)
        {
            UnPackAuxiliary.Read(stream, out uint var0);
            Result = (UpgradeResult)var0;
            UnPackAuxiliary.Read(stream, out bool var1);
            if(var1)
            {
                Info = new UpgradeIncInfo();
                Info.UnPack(stream);
            }
        }
    }
    
    public struct ResolveQ : IIdPackable
    {
        public int EquipId;
        
        public uint PackableId => 23;
        
        public void Pack(MemoryStream stream)
        {
            PackAuxiliary.Write(stream, 23u);
            PackAuxiliary.Write(stream, (uint)EquipId);
        }
    }
    
    public class NoticeNewEquipP : IUnPackable
    {
        public EquipInfo Equip;
        
        public const uint Sid = 10;
        
        public void UnPack(MemoryStream stream)
        {
            Equip = new EquipInfo();
            Equip.UnPack(stream);
        }
    }
    
    public enum EquipEnum
    {
        GetEquipBagP,
        UpgradeP,
        NoticeNewEquipP,
    }
}
